//
//  UWCurtain.m
//  Urban Words
//
//  Created by Tim Brandin on 2011-12-15.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "UWCurtain.h"

@implementation UWCurtain

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    if ([target respondsToSelector:actionBegan]) {
        [target performSelector:actionBegan withObject:touches];
    }
    [super touchesBegan:touches withEvent:event];
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
    if ([target respondsToSelector:actionCancelled]) {
        [target performSelector:actionCancelled withObject:touches];
    }
    [super touchesCancelled:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    if ([target respondsToSelector:actionEnded]) {
        [target performSelector:actionEnded withObject:touches];
    }
    [super touchesEnded:touches withEvent:event];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    if ([target respondsToSelector:actionMoved]) {
        [target performSelector:actionMoved withObject:touches];
    }
    [super touchesMoved:touches withEvent:event];
}

- (void)addTouchListener:(id)object actionBegan:(SEL)began
             actionEnded:(SEL)ended actionCancelled:(SEL)cancel
             actionMoved:(SEL)moved
{
    target = object;
    actionMoved = moved;
    actionEnded = ended;
    actionCancelled = cancel;
    actionBegan = began;
}

@end
